import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from "unplugin-auto-import/vite"
import Components from 'unplugin-vue-components/vite'
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
export default defineConfig({
  plugins: [vue(),
  AutoImport({
    imports: ["vue", "vue-router", "pinia"], //自动引入vue的ref、toRefs、onmounted等，无需在页面中再次引入
    resolvers: [
      ElementPlusResolver(),
    ]
  }),
  Components({
    resolvers: [
      ElementPlusResolver(),
    ],
  }),
  ],
  resolve: {
    alias: {
      '@': '/src',
    },
  },
  server: {
    host: '0.0.0.0',
    port: '3333',
    proxy: {
      '/API': {
        target: 'http://dev.hua-v.com:12348/plt/api',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/API/, ''), //api替换为'',
      },
    },
  },
})